/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"7F7DB20D-BD51-46BF-A928-98A87B55FE9E",variableType:4}
 */
var fCuentaCyb = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"7AD5FC1B-FC73-44B8-BB4F-D59F689C2DE2",variableType:93}
 */
var fFechaDesde = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"F2A3F375-CA70-4222-907A-EBCEAC1720F3",variableType:93}
 */
var fFechaHasta = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"5E6736D1-396B-4863-AA2A-71106ED551A2"}
 */
function onActionCalcular(event) {
	var query = 'SELECT imputacion_id, SUM(importe) as "tot_importe" FROM movim_cyb where fecha_movim between ? and ?'+
			' and cuentas_cyb_id = ? group by imputacion_id order by imputacion_id;'
	
	var args = new Array(fFechaDesde,fFechaHasta,fCuentaCyb)
	
	var ds = databaseManager.getDataSetByQuery('infocom',query,args,-1)
	//application.output(ds.getAsText(' ; ','\n','"',true))
	
	var $frm = solutionModel.getForm('ficha_maestra_cyb_tab')
	var tipos = new Array(JSColumn.INTEGER)
	
	var cols = ds.getColumnNames().length
	for (var i = 1; i <= cols ; i++)
	{
		tipos[i] = JSColumn.NUMBER
	}
	$frm.dataSource = ds.createDataSource('ficha2',tipos)
	forms[$frm.name].controller.recreateUI()
	
	forms[$frm.name].fFechaDesde = utils.dateFormat(fFechaDesde,'dd-MM-yyyy')
	forms[$frm.name].fFechaHasta = utils.dateFormat(fFechaHasta,'dd-MM-yyyy')
	forms[$frm.name].fCyb = fCuentaCyb
	//application.showFormInDialog(forms[$frm.name],-1,-1,-1,-1,'Ficha Caja y Bancos',false,false,'fCyb',true)
	globals.formEnVentana($frm.name,'fCyb','Ficha Caja y Bancos')
}
